package org.snia.cdmi.model;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "DataSlice")
public class MetaSliceData {
	
	//文件片的md5值
	private String md5;
	//文件片的引用次数
	private int number;
	//引用的对象的版本
	private List<String> versionObject;

	/**
	 * @param md5 the md5 to set
	 */
	public void setMd5(String md5) {
		this.md5 = md5;
	}

	/**
	 * @return the md5
	 */
	public String getMd5() {
		return md5;
	}

	/**
	 * @param number the number to set
	 */
	public void setReferenceNumber(int number) {
		this.number = number;
	}

	/**
	 * @return the number
	 */
	public int getReferenceNumber() {
		return number;
	}
	
	/**
	 * 
	 */
	public void addReference(int time){
		this.number = this.number + time;
		if(this.number < 0 ){
			this.number = 0;
		}
	}

	/**
	 * @param versionObject the versionObject to set
	 */
	public void setVersionObject(List<String> versionObject) {
		this.versionObject = versionObject;
	}

	/**
	 * @return the versionObject
	 */
	public List<String> getVersionObject() {
		return versionObject;
	}
	
	public void addVersion(String versionId){
		if(this.versionObject == null){
			this.versionObject = new ArrayList<String>();
		}
		this.versionObject.add(versionId);
	}
}
